import $http from '../utils/api'
// 登录
export const login=(code:string | undefined,phone:string | undefined)=>{

 return $http.get(`/m/user/login?js_code=${code}&phone_code=${phone}`)

}
// 签到
 interface dao {
    date: string,
    info: string,
  }
export const qiandao =(params:dao[])=>{

    return $http.post('/tian/dao',params)
}

// 获取签到数据
export const qiandaoData =()=>{

  return $http.get('/tian/getDao')
}
// 获取科目数据
export const getKemu =()=>{

  return $http.get('/Alissues/get')
}
// 获取轮播数据
export const getKimg =()=>{

  return $http.get('/Alissues/gettupian')
}
// 获取试题数据
export const getKemushiti =(id:any)=>{

  return $http.get(`/Alissues/getdetails?id=${id}`)
}

// 新增讨论数据
export const xiznengtao =(params:any)=>{

  return $http.post(`/lun/jia`,params)
}
// 获取讨论数据
export const getengtao =()=>{

  return $http.get(`/lun/getlun`)
}
// 新增讨论数据
export const xtngtao =(params:any)=>{

  return $http.post(`/lun/tilun`,params)
}
// 获取讨论数据
export const getlunx =(id:any)=>{

  

  return $http.get(`/lun/getlunx?id=${id}`)
}

// 获取用户信息
export const getuser =()=>{

  

  return $http.post(`/m/user/info`)
}
// 首页数据获取
export const getindex =()=>{

  

  return $http.post(`/m/iot/list`)
}
// 获取设备详情
export const getXaingqq =(id:number)=>{

  

  return $http.get(`/m/iot/config?Id=${id}`)
}


// 打饭

export const dafanti =(params:any)=>{

  

  return $http.post(`/m/iot/config`,params)
}

// 打饭

export const addshebei =(params:any)=>{

  

  return $http.post(`/m/iot/add`,params)
}
export const putshebei =(params:any)=>{

  

  return $http.post(`/m/iot/upd`,params)
}


export const sousuo =(search:any)=>{

  

  return $http.get(`/m/iot/query?search=${search}`)
}

export const sousuoPosition =(search:any)=>{

  

  return $http.get(`/m/iot/list/query?position=${search}`)
}


export const getDedail =(search:any)=>{

  

  return $http.get(`/m/iot/list/detail?id=${search}`)
}


// export const getfenshi =(data:any)=>{

  

//   return $http.get(`/m/analyse/charts/rice_dispenser_running_trend?date_type=${data.date_type}&day=${data.day}
//   &month=${data.month}&year=${data.year}`)
// }
export const getfenshi =(data:any)=>{

  console.log(data);
  

  return $http.get(`/m/analyse/charts/rice_dispenser_running_trend`,data)
}
export const getfenshimi =(data:any)=>{

  console.log(data);
  

  return $http.get(`/m/analyse/charts/rice_porition_same_period_comparison`,data)
}


export const getfenpian =(data:any)=>{

  

  return $http.get(`/m/analyse/charts/rice_portion_preference`,data)
}

export const fenx =()=>{

  

  return $http.get(`/m/analyse/pannels/rice_dispenser`,)
}



export const xinzengshouhou =(params:any)=>{

  

  return $http.post(`/m/after_sales/add`,params)
}

export const xinzengsshouhou =(params:any)=>{

  

  return $http.post(`/m/after_sales/upd`,params)
}

export const fenxsshou =()=>{

  

  return $http.get(`/m/after_sales/list`,)
}

export const getxsshoude =(id:any)=>{

  

  return $http.get(`/m/after_sales/list/detail?id=${id}`,)
}
export const getyanzheng =(number:any)=>{

  

  return $http.get('/m/user/login/sms/send',number)
}

export const dengyanzheng =(number:any)=>{

  

  return $http.get('/m/user/login/sms',number)
}
